# Stage 1: Build with Maven
FROM maven:3.8.4-openjdk-8 AS build-with-maven
RUN mkdir ./shiro.test
COPY / ./shiro.test/
WORKDIR ./shiro.test/
RUN mvn clean package
# Stage 2: Run App
FROM openjdk:8 AS run-app
RUN mkdir ./shiro.test
# Copy Artifact from Stage 1
COPY --from=build-with-maven ./shiro.test/src/main/resources/ ./shiro.test/src/main/resources/
COPY --from=build-with-maven ./shiro.test/target/shiro.test-1.0.jar ./shiro.test/
CMD java  -jar ./shiro.test/shiro.test-1.0.jar --spring.profiles.active=${SPRING_PROFILES_ACTIVE}